<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    * {
        padding: 0;
        margin: 0;
    }

    .container {
        width: 800px;
        height: 400px;
        margin: 50px auto;
        background-color: rgba(4, 64, 66, 0.705);
    }

    .container form {
        width: 450px;
        height: 300px;
        margin: 50px auto;
        border-radius: 20%;
        background-color: rgba(255, 127, 80, 0.281);
        border: 1px solid red;
    }

    .container .a {
        width: 350px;
        height: 100px;
        margin: auto;
        font-size: x-large;
        line-height: 50px;
    }

    input {
        height: 30px;
        width: 250px;
    }

    button {
        font-size: x-large;
        width: 150px;
        margin-left: 100px;
    }
</style>

<body>
    <div class="container">
        <h3>登录界面</h3>
        <form>
            <div class="a">用户名: <input type="text" name="username"></div>
            <div class="a">密&nbsp&nbsp&nbsp码: <input type="text" name="password"></div>
            <div class="a">数&nbsp&nbsp&nbsp字: <input type="text" name="money"></div>
            <div class="a"><button type="button">登录</button></div>
        </form>
    </div>
    <script src="./cookieUtil.js"></script>
    <script>
        let btn = document.querySelector('button')
        console.log(btn)
        btn.onclick = function () {
            let username = document.querySelector('input[name="username"]').value
            console.log(username)
            let password = document.querySelector('input[name="password"]').value
            let money = document.querySelector('input[name="money"]').value
            console.log(password)
            let expir=1000*60*60*24   //设置过期时间
            setCookie('user', username, expir)
            setCookie('pass', password, expir)
            setCookie('cart', money, expir)
            location.href='2.html'
        }

    </script>
</body>

</html>